package cn.tedu.carehome.foundation.service.impl;

import cn.tedu.carehome.foundation.mapper.RoleMapper;
import cn.tedu.carehome.foundation.pojo.vo.RoleListItemVO;
import cn.tedu.carehome.foundation.service.IRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Iterator;
import java.util.List;

/**
 * 角色业务实现类
 * @author 张子豪
 * @version 0.0.1
 */

@Service
@Slf4j
public class RoleServiceImpl implements IRoleService {

    @Autowired
    private RoleMapper roleMapper;
    @Override
    public List<RoleListItemVO> list() {
        log.debug("开始处理查询角色列表的业务");
        List<RoleListItemVO> list = roleMapper.list();
        Iterator<RoleListItemVO> iterator = list.iterator();
        while (iterator.hasNext()){
            RoleListItemVO roleListItemVO=iterator.next();
            if (roleListItemVO.getName().equals("院长")){
                iterator.remove();
            }
        }
        return list;
    }
}
